package org.jsola.hr.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jsola.common.DateKit8;
import org.jsola.core.vo.BaseVO;

import static org.jsola.hr.example.AttendPunchRecordExample.*;

/**
 * @author lyh
 */
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "【考勤打卡记录】下班相关信息")
@Data
public class AttendPunchRecordLeaveListVO extends BaseVO implements Comparable<AttendPunchRecordLeaveListVO>{

    @ApiModelProperty(notes = N_LEAVE_STATUS)
    private String leaveStatus;

    @ApiModelProperty(notes = N_LEAVE_TIME)
    private String leaveTime;

    @ApiModelProperty(notes = N_LEAVE_PLACE)
    private String leavePlace;

    @ApiModelProperty(notes = "是否在打卡范围内;1-是,0-否")
    private String rangeState;

    @Override
    public int compareTo(AttendPunchRecordLeaveListVO o) {
        if (this.getLeaveTime() == null || o.getLeaveTime() == null) {
            return 0;
        }
        if (DateKit8.parseDateTime(this.getLeaveTime()).getTime() >
                DateKit8.parseDateTime(o.getLeaveTime()).getTime()) {
            return 1;
        } else {
            return -1;
        }
    }
}
